package com.tongji.housediy.view.skins.buttonskin
{
	import com.tongji.housediy.events.commonEvent.ChangeData3D;
	import com.tongji.housediy.model.CompEnableStateModel;
	
	import flash.events.MouseEvent;
	
	import mx.binding.utils.BindingUtils;
	
	import org.robotlegs.mvcs.Mediator;

	/**
	 * 
	 * @author xuxunjia
	 * 
	 */	
	public class ProjectionBtnMediator extends Mediator
		
	{
		[Inject]
		public var view:ProjectionBtnSkin;
		
		[Inject]
		public var model:CompEnableStateModel;
		
		override public function onRegister():void
		{
			BindingUtils.bindProperty(view.hostComponent, "enabled", model, "isProjectionBtnEnable");
			
			view.hostComponent.addEventListener(MouseEvent.CLICK, projectionBtnClickHandler);
		}
		
		private function projectionBtnClickHandler(e:MouseEvent):void
		{
			dispatch(new ChangeData3D(ChangeData3D.PROJECTION_CHANGE));
		}
	}
}